import { Application } from "egg";

export default (app: Application) => {
  const { controller, router } = app;
  // 添加路由api前缀
  router.prefix("/api");
  // RESUL API设计
  router.resources("test", "/test", controller.test);
  router.resources("company", "/company", controller.company);
  router.resources("position", "/position", controller.position);
  router.resources("department", "/department", controller.department);
  router.resources("role", "/role", controller.role);
  router.post("/role/groupAdd", controller.role.groupAdd);
  router.resources("privileges", "/privileges", controller.privilegesType);
  router.post("/privileges/typeAdd", controller.privilegesType.createType);
  router.resources("user", "/user", controller.user);
  router.post("/sendVeriCode", controller.user.sendPhoneVeriCode); // 验证码发送
  router.post("/verifyPhoneCode", controller.user.verifyPhoneCode); // 验证手机验证码
  router.post("/orgRegister", controller.user.orgRegister); //  企业注册
  router.post("/loginByCode", controller.user.loginByCode); //  验证码登录
  router.post("/loginByPass", controller.user.loginByPass); //  密码登录
  router.resources("hospital", "/hospital", controller.hospital);
  router.resources("drugFactory", "/drugFactory", controller.drugFactory);
  router.resources("brand", "/brand", controller.brand);
  router.resources("standard", "/standard", controller.standard);
  router.resources(
    "businessCompany",
    "/businessCompany",
    controller.businessCompany
  );
  router.resources("basicField", "/basicField", controller.basicField);
  router.post("/basicField/add", controller.basicField.fieldAdd);
  router.resources("drug", "/drug", controller.drug);
  router.post("/drug/findByCondition", controller.drug.findByCondition);
  router.resources("warehouse", "/warehouse", controller.warehouse);
  router.post("/warehouse/outWare", controller.warehouse.outWare);
  router.get("/warehouse/record", controller.warehouse.getRecordList);
  router.get("/warehouse/recede/:id", controller.warehouse.recede);
  router.post("/report/exportSellData", controller.report.exportSellData);
};
